package api

import (
	"github.com/gin-gonic/gin"
	"go-two/dao"
	"go-two/models"
	"go-two/response"
	"go-two/tools"
)

// AddUser 用户添加api
func AddUser(c *gin.Context) {
	var user models.User
	if err := c.BindJSON(&user); err != nil {
		response.Failed("参数错误", c)
		return
	}
	dao.Mgr.AddUser(&user)
	response.Success("添加成功", user, c)
}

// ListUser 用户查询api
func ListUser(c *gin.Context) {
	users := dao.Mgr.ListUser()
	tools.Logger.Errorf("[error-info:%+v]", users)
	response.Success("success", users, c)
}
